package com.binarysearch;

public class BinarySearch {

    public static void main(String[] args) {
        int start = 1;
        int end = 100;
        int target = 110;
        System.out.println(binarySearch(start, end, target));
    }

    public static boolean binarySearch(int start, int end, int target) {
        while (start + 1 < end) {
            int mid = start + (end - start) / 2;
            if (mid == target) {
                return true;
            } else if (target > mid) {
                start = mid;
            } else {
                end = mid;
            }
        }
        if (start == target || end == target) return true;
        return false;
    }
}
